<?php
// +----------------------------------------------------------------------
// | quanli team
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.fistforward.com/ All rights reserved.
// +----------------------------------------------------------------------
// | create by allen.qiang
// +----------------------------------------------------------------------


/**
 * 账户异动操作功能
 * @package  htdocs
 * @subpackage  quanliadmin
 * @author   create by allen.qiang
 */

quanli_require('module/base/customer/financeChange.class.php');
quanli_require('module/base/system/sysPayment.class.php');
quanli_require('module/base/system/itemHandler.class.php');
quanli_require('module/base/system/sysDepartment.class.php');
quanli_require('module/base/system/sysUser.class.php');

class pa_financeChange{

    public function execute() {

        if (isset($_REQUEST['operFlg']) && quanli_is_int($_REQUEST['operFlg'])) {

            switch ( $_REQUEST['operFlg'] ) {

                case 1: //账户异动查询
                    $this->accountSelect();
                    break;
                //add by allen.qiang 20141214 批量导入积分 start
                case 4:
                    $this->JFimport();
                //add by allen.qiang 20141214 批量导入积分 end
                default:
                    backendError();
                    break;

            }

        } else {

            backendError();

        }

    }
    /**
     * 账户异动查询
     *
     */
    private function accountSelect() {

        global $G_PGLOB;

        //付款方式
        $itemHandler = new itemHandler();
        $args_array = array( 'item' => '43');
        $item_category_array = $itemHandler->searchItemList($args_array);
        foreach($item_category_array as &$item) {
            $array[] = array(
                'itemID' => $item->itemID,
                'itemName' => $item->itemName
            );

        }
        //实例用户类
        $sysUser = new sysUser( $G_PGLOB->DBCA );

        //当前登录用户信息
        $args_array = array(
            'userID' => $G_PGLOB->currentUserID
        );
        $userInfo_array = $sysUser->searchUserInfo( $args_array );
        $departmentID = $userInfo_array[0]['departmentID'];

        //实例化部门类
        $sysDepartment = new sysDepartment();

        //部门数据
        $department_array = array();
        //递归查询部门数据
        $sysDepartment->searchDepartment( $department_array, 0, -1,$departmentID);

        //生成部门下拉框html代码
        $department_select_html = '';
        $sysDepartment->createDepartmentSelectOptionHtml( $department_array, $department_select_html );
        $G_PGLOB->smarty->assign_by_ref('department_select_html', $department_select_html);

        $G_PGLOB->smarty->assign_by_ref('paymentMethod', $array);

        $G_PGLOB->smarty->assign('edit_permission', $G_PGLOB->has_permission(3006));

        $G_PGLOB->smarty->display('customer/accountlist.tpl');
    }

} 